
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class FmsFormulaManageServiceImpl implements FmsFormulaManageService  {

    @Resource
    private FmsFormulaManageMapper fmsFormulaManageMapper;

    /**
     * 获取 FmsFormulaManage 分页列表
     */
    @Transactional
    public IPage getFmsFormulaManagePagination( PaginationVo paginationVo, FmsFormulaManageQuery fmsFormulaManageQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<FmsFormulaManageEntity> lqs = new LambdaQueryWrapper();
        fmsFormulaManageMapper.selectPage(page, lqs);

        List<FmsFormulaManageEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 FmsFormulaManage 所有数据
     *
    */
    @Transactional
    public List<FmsFormulaManageEntity> getFmsFormulaManageAllList( FmsFormulaManageQuery fmsFormulaManageQuery ) throws Exception {

        LambdaQueryWrapper<FmsFormulaManageEntity> lqs = new LambdaQueryWrapper();
        List<FmsFormulaManageEntity> list = fmsFormulaManageMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 FmsFormulaManage 详情
    */
    @Transactional
    public FmsFormulaManageEntity getFmsFormulaManageDetail( Long id) throws Exception {

        FmsFormulaManageEntity fmsFormulaManage = fmsFormulaManageMapper.selectById(id);
        return fmsFormulaManage;
    }


    /**
     * 新增 FmsFormulaManage
     * */
    @Transactional
    public void addFmsFormulaManage(FmsFormulaManageVo fmsFormulaManageVo) throws Exception {

        FmsFormulaManageEntity fmsFormulaManage = new FmsFormulaManageEntity();
        ReflectionCopy.copyProperties( fmsFormulaManage, fmsFormulaManageVo );
        fmsFormulaManageMapper.insert(fmsFormulaManage);
        return;
    }


    /**
     * 更新 FmsFormulaManage
     * */
    @Transactional
    public void updateFmsFormulaManage( FmsFormulaManageVo fmsFormulaManageVo) throws Exception {

        if( fmsFormulaManageVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        FmsFormulaManageEntity fmsFormulaManage = new FmsFormulaManageEntity();
        ReflectionCopy.copyProperties( fmsFormulaManage, fmsFormulaManageVo );
        fmsFormulaManageMapper.updateById(fmsFormulaManage);
        return;
    }

    /**
     * 删除 FmsFormulaManage
     * */
    @Transactional
    public void batchRemoveFmsFormulaManage( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        fmsFormulaManageMapper.deleteBatchIds(ids);
    }

}

      